package ca.etsmtl.log660.dao;

public class SQLBuilder {
	
	public static String getQueryCoteForFilm(String filmId) {
		return "SELECT cote FROM ma_vue_moyenne WHERE idFilm=" + filmId;
	}
	
	public static String getRecomandationQuery(String filmId, String clientId) {
		return "SELECT filmcons FROM ( SELECT * FROM ( SELECT film1 AS Film, film2 AS FilmCons, r FROM ma_vue_correlations " +
				"UNION SELECT film2 AS Film, film1 AS FilmCons, r FROM ma_vue_correlations ) WHERE Film = " + filmId +
				" ORDER BY r DESC ) WHERE rownum <= 3 AND filmcons NOT IN ( SELECT idFilm FROM cotes WHERE idclient = " + clientId + ")";
	}
	
	public static String getCorelationFactorQuery(String filmId, String filmSuggereId) {
		return "SELECT r FROM ( SELECT film1 AS Film, film2 AS FilmCons, r FROM ma_vue_correlations UNION " +
				"SELECT film2 AS Film, film1 AS FilmCons, r FROM ma_vue_correlations) WHERE Film = " + filmId + " AND FilmCons = " + filmSuggereId;
	}
}
